package com.sms.client.request;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @desc 模板短信实例
 * @author wjw
 * @time 2017年11月16日下午2:36:44
 */
public class TemplateSms implements Serializable {
    
    /** FIXME */
    private static final long serialVersionUID = -5604942528942609501L;
    /** 接收手机号 */
    private String mobile;
    /** 来自某用户 */
    private String fromUser;
    /** 发送给某用户 */
    private String toUser;
    /** 短信模板编码 */
    private String templateCode;
    /** 模板参数 */
    private Map<String, String> parameters;
    
    public TemplateSms() {
		// TODO Auto-generated constructor stub
	}
    
    /** 如果不传模板编码则使用默认模板编码发送短信 */
    public TemplateSms(String mobile, String fromUser,String toUser) {
    	// TODO Auto-generated constructor stub
    	this.mobile=mobile;
    	this.fromUser=fromUser;
    	this.toUser=toUser;
    }
    
    public TemplateSms(String mobile, String templateCode, String fromUser,String toUser) {
    	// TODO Auto-generated constructor stub
    	this.mobile=mobile;
    	this.templateCode=templateCode;
    	this.fromUser=fromUser;
    	this.toUser=toUser;
    }
    
    
    public String getMobile() {
		return mobile;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public String getFromUser() {
		return fromUser;
	}
	public void setFromUser(String fromUser) {
		this.fromUser = fromUser;
	}
	public String getToUser() {
		return toUser;
	}
	public void setToUser(String toUser) {
		this.toUser = toUser;
	}
	public String getTemplateCode() {
		return templateCode;
	}
	public void setTemplateCode(String templateCode) {
		this.templateCode = templateCode;
	}
	public Map<String, String> getParameters() {
		return parameters;
	}
	public void setParameters(Map<String, String> parameters) {
		this.parameters = parameters;
	}

	/**
     * 添加模板参数
     * @param key
     * @param value
     */
    public void addParameter(String key, String value) {
        if (parameters == null) {
            parameters = new HashMap<String, String>();
        }
        parameters.put(key, value);
    }
    
    @Override
    public String toString() {
        return "TemplateSms [mobile=" + mobile + ", fromUser=" + fromUser + ", toUser=" + toUser + ", templateCode="
            + templateCode + "]";
    }
    
}
